home *** CD-ROM | disk | FTP | other *** search
- Program EditOverwrite;
-
- {$R OVERWRT.RES}
-
- Uses
- WObjects, WinTypes, WinProcs, Strings, Ovrtpu;
-
- const
- AppName = 'OverWrt';
-
- (* Test Defines *)
- Id_Edit = 100;
-
- (* Menu Defines *)
- Cm_About = 100;
- Cm_Test = 101;
-
- AboutDlg = 'ABOUT';
- TestDlg = 'TEST';
- MenuName = 'MAINMENU';
- IconName = 'MAINICON';
-
- type
- TEditApplication = object(TApplication)
- procedure InitMainWindow; virtual;
- end;
-
- PTestDlg = ^TTestDlg;
- TTestDlg = object(TDialog)
- Editor : POverwrite;
- Constructor Init(AParent : PWindowsObject; AName : PChar);
- end;
-
- POvrWriteWindow = ^TOvrWriteWindow;
- TOvrWriteWindow = object(TWindow)
- constructor Init(AParent : PWindowsObject; AName : PChar);
- procedure GetWindowClass(var AWndClass : TWndClass); virtual;
- procedure Test(var Msg : TMessage);
- virtual cm_First + cm_Test;
- procedure About(var Msg : TMessage);
- virtual cm_First + cm_About;
- end;
-
- (********************)
- (* TEditApplication *)
- (********************)
- procedure TEditApplication.InitMainWindow;
- begin
- MainWindow:=New(POvrWriteWindow, Init(nil,'OverWrite Demo'));
- end;
-
- (************)
- (* TTestDlg *)
- (************)
- constructor TTestDlg.Init(AParent : PWindowsObject; AName : PChar);
- begin
- TDialog.Init(AParent, AName);
- Editor:=New(POverwrite, InitResource(@Self,ID_EDIT,100));
- end;
-
- (*******************)
- (* TOvrWriteWindow *)
- (*******************)
- constructor TOvrWriteWindow.Init(AParent : PWindowsObject; AName : PChar);
- begin
- TWindow.Init(AParent, AName);
- Attr.Menu:=LoadMenu(Hinstance,MenuName);
- end;
-
- procedure TOvrWriteWindow.GetWindowClass(var AWndClass : TWndClass);
- begin
- TWindow.GetWindowClass(AWndClass);
- AWndClass.HIcon:=LoadIcon(HInstance, IconName);
- end;
-
- procedure TOvrWriteWindow.Test(var Msg : TMessage);
- begin
- Application^.ExecDialog(New(PTestDlg,Init(@Self,TestDlg)));
- end;
-
- procedure TOvrWriteWindow.About(var Msg : TMessage);
- begin
- Application^.ExecDialog(New(PDialog,Init(@Self,AboutDlg)));
- end;
-
- (**** MAIN ****)
- var
- EditApp : TEditApplication;
- begin
- EditApp.Init(AppName);
- EditApp.Run;
- EditApp.Done;
- end.